/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controllers;

import models.*;

/**
 *
 * @author C_Administrador
 */
public class Security extends Secure.Security{
    
        static boolean authenticate(String username, String password) {
 /*
        Alumno.deleteAll();
        Usuario.deleteAll();
        Representante_Comite.deleteAll();
        Administrador.deleteAll();
        Candidatos_AU.deleteAll();
        Candidatos_CF.deleteAll();
        Candidatos_CU.deleteAll();
      
        
        
        //--Creamos el usuario con Rol de Comite
        new Usuario("00000000", "000", "Comite Electoral").save();
        new Usuario("99999999", "999", "Administrador").save();
        new Usuario("11111111", "111", "Alumno").save();
        new Usuario("22222222", "222", "Alumno").save();
        
        //-- asiganamos un Representante de Comite al Usuario
        new Representante_Comite("00000000", "William", "Manrique","Av. Los Tulipanes Rosados", "0008 - 2322", "lawilly@launica.com").save();
        new Alumno("11111111","Lennin Paul","Quiroz Villalobos","Ing. SOftware").save();
        new Alumno("22222222","Ruben ","Chavez Quiroz","Ing. SOftware").save();        
        new Administrador("99999999","Frank","Chavez","Malpartida").save();
        
        //--creamos los candidatos para cada organo de Gobierno
        new Candidatos_AU("3","33333333").save();
        new Candidatos_AU("4","44444444").save();
        new Candidatos_AU("5","55555555").save();
                
        new Candidatos_CF("3","30303030").save();
        new Candidatos_CF("4","40404040").save();
        new Candidatos_CF("5","50505050").save();
        
        new Candidatos_CU("3","66666666").save();
        new Candidatos_CU("4","77777777").save();
        new Candidatos_CU("5","88888888").save();
      
        if(!username.equals("00000000")){
            System.out.println("Entro :D ");
             Votos_Acumulados.deleteAll();
            
            new Votos_Acumulados("0","0","0","0").save();
            new Votos_Acumulados("0","0","0","3").save();
            new Votos_Acumulados("0","0","0","4").save();
            new Votos_Acumulados("0","0","0","5").save();
        } 
       */ 
        System.out.println("Autenticando...");
        
        return Usuario.connect(username, password) != null;
    }
        
        
    
}
